import request from '@/utils/request';
import { DEFAULT_URL_SYSTEM_MANAGE } from '@/constants';

/**
 * 数据字典值值管理-查询数据字典值列表
 */
export async function queryConfigDictionary({ code }) {
  return request(`${DEFAULT_URL_SYSTEM_MANAGE}/configdic/category/${code}`);
}

/**
 * 数据字典值管理-保存数据字典值
 * @param {*} option
 */
export async function saveConfigDictionary(option) {
  return request(`${DEFAULT_URL_SYSTEM_MANAGE}/configdic`, option);
}

/**
 * 数据字典值管理-修改数据字典值
 * @param {*} option
 */
export async function updateConfigDictionary(option) {
  const { body } = option;
  return request(`${DEFAULT_URL_SYSTEM_MANAGE}/configdic/${body.id}`, option);
}

/**
 * 数据字典值管理-删除数据字典值
 * @param {*} option
 */
export async function deleteConfigDictionary({ id }) {
  const options = { method: 'DELETE' };
  return request(`${DEFAULT_URL_SYSTEM_MANAGE}/configdic/${id}`, options);
}